//
//  ProfileNormalVC.m
//  HengYouCai
//
//  Created by ycgwl on 2017/5/3.
//  Copyright © 2017年 lwj. All rights reserved.
//

#import "ProfileNormalVC.h"
#import "HengYouCai-Swift.h"

@interface ProfileNormalVC ()
@end

@implementation ProfileNormalVC


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUI];
}

/**
 初始化界面
 */
- (void)setUI
{
    self.view.backgroundColor = Normal_BackColor;
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self.view addSubview:self.pageTitleView];
    [self.view addSubview:self.pageContentView];
}
#pragma PageTitleViewDelegate
- (void)pageTitleView:(PageTitleView *)titleView selectedIndex:(NSInteger)index
{
    [_pageContentView setCurrentIndex:index];
}
#pragma PageContentViewDelegate

- (void)pageContentView:(PageContentView *)contentView progress:(CGFloat)progress sourceIndex:(NSInteger)sourceIndex targetIndex:(NSInteger)targetIndex
{
    [_pageTitleView setTitleWithProgress:progress sourceIndex:sourceIndex targetIndex:targetIndex];
}
#pragma 懒加载
- (PageTitleView *)pageTitleView
{
    if (!_pageTitleView) {
        
        /**
         标题栏
         */
        _pageTitleView = [[PageTitleView alloc] initWithFrame:CGRectMake(0, kJcwGetNavHeight(), f_Device_w, _titleH) titles:self.titles];
        _pageTitleView.delegate = self;
        _pageTitleView.grayLineView.hidden = !_grayLineIsHid;
        _pageTitleView.backgroundColor = [UIColor whiteColor];
    }
    return _pageTitleView;
}
- (PageContentView *)pageContentView
{
    if (!_pageContentView) {
        /**
         内容
         */        
        CGRect rect = CGRectMake(0, kJcwGetNavHeight()+_titleH+_intervalH, f_Device_w, f_Device_h-(kJcwGetNavHeight()+_titleH+_intervalH+_bottomHeight));
        
        _pageContentView = [[PageContentView alloc] initWithFrame:rect childVcs:_contents parentViewController:self];
        _pageContentView.delegate = self;
    }
    return _pageContentView;
}
@end
